package kz.home.obj;

import java.util.Vector;

/**
 * <strong>title</strong>
 * <p> describe
 *
 * @author: Danik <br>
 * Date: 15.07.2009  <br>
 * Time: 12:25:00  <br>
 */
public class City {
    private String id;
    private String name;
    private String state;
    private Vector cinemas;
    protected static String symbol = "/";

    private Vector movies;
    private Vector times;


    public City(String id, String name, String state, Vector cinemas, Vector movies, Vector times) {
        this.id = id;
        this.name = name;
        this.state = state;
        this.cinemas = cinemas;
        this.movies = movies;
        this.times = times;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Vector getCinemas() {
        return cinemas;
    }

    public void setCinemas(Vector cinemas) {
        this.cinemas = cinemas;
    }

    public Vector getMovies() {
        return movies;
    }

    public void setMovies(Vector movies) {
        this.movies = movies;
    }

    public Vector getTimes() {
        return times;
    }

    public void setTimes(Vector times) {
        this.times = times;
    }

    public byte[] getRecord() {
        return (id + symbol + name + symbol + state + symbol).getBytes();
    }

    public static City getCity(byte[] seed) {
        String token = new String(seed);
        int index = 0;

        String id = token.substring(index, index = token.indexOf(symbol, index));
        String name = token.substring(index + 1, index = token.indexOf(symbol, index + 1));
        String state = token.substring(index + 1, token.indexOf(symbol, index + 1));

        return new City(id, name, state, null, null, null);
    }
}
